import request from '@/utils/request'

/**
 * 管理员登录登录
 * @param {*} data
 * @returns
 */
export const adminLoginAPI = (data) => {
  return request({
    url: '/admin',
    method: 'post',
    data: data,
  })
}

/**
 * 管理员登出
 * @returns
 */
export const adminLogoutAPI = () => {
  return request({
    url: '/admin',
    method: 'get',
  })
}

/**
 * 更新管理员信息
 */
export const updateAdminInfoAPI = (data) => {
  return request({
    url: `/admin/${data.id}`,
    method: 'put',
    data: data,
  })
}

/**
 * 更新管理员密码
 */
export const updateAdminPasswordAPI = (data) => {
  return request({
    url: `/admin/${data.id}`,
    method: 'patch',
    data: data,
  })
}

export const adminInfoAPI = () => {
  return request({
    url: '/admin/info',
    method: 'get',
  })
}
